package com.ht.web_vr_home_tour_backend.obj.dto;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ht.web_vr_home_tour_backend.obj.enums.PojType;
import com.ht.web_vr_home_tour_backend.obj.pojo.ObjInfo;
import com.ht.web_vr_home_tour_backend.obj.pojo.PojInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Data
@ApiModel("项目传输对象")
public class PojInfoDto {
    @TableId
    Long id;

    @ApiModelProperty("项目名称")
    String name;

    @ApiModelProperty("项目介绍（正文）")
    String description;

    @ApiModelProperty("项目类型")
    PojType pojType;

    @ApiModelProperty("项目引用的所有对象")
    List<ObjInfo> objInfoList;

    @ApiModelProperty("项目创建时间")
    @TableField(fill = FieldFill.INSERT)
    LocalDateTime createTime;

    @ApiModelProperty("项目更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    LocalDateTime updateTime;

    @ApiModelProperty("项目归属用户")
    @TableField(fill = FieldFill.INSERT)
    Long createUser;

    public PojInfoDto(PojInfo pojInfo, List<ObjInfo> objInfoList) {
        this.id = pojInfo.getId();
        this.name = pojInfo.getName();
        this.description = pojInfo.getDescription();
        this.pojType = pojInfo.getPojType();
        this.createTime = pojInfo.getCreateTime();
        this.updateTime = pojInfo.getUpdateTime();
        this.createUser = pojInfo.getCreateUser();
        this.objInfoList = objInfoList;
    }
}
